﻿namespace NTLib.Core.Attributes
{
    using System;
    using System.Runtime.InteropServices;

    /// <summary>
    /// Define a Unique Guid for the specific element tag with this attributes.
    /// </summary>
    [AttributeUsage(AttributeTargets.Assembly |
                    AttributeTargets.Class | 
                    AttributeTargets.Struct | 
                    AttributeTargets.Enum | 
                    AttributeTargets.Interface | 
                    AttributeTargets.Delegate, Inherited = false)]
    [ComVisible(true)]
    public sealed class GuidAttribute : Attribute
    {
        #region Ctor

        /// <summary>
        /// Initializes a new instance of the <see cref="GuidAttribute"/> class.
        /// </summary>
        /// <param name="guid">The unique identifier.</param>
        public GuidAttribute(string guid)
        {
            this.Value = Guid.Parse(guid);
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets the guid value.
        /// </summary>
        public Guid Value { get; }

        #endregion
    }
}
